@extends('admin.public.base')


@section('title', '角色')


@section('content')

    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span>
        角色管理
        <span class="c-gray en">&gt;</span>
        角色列表
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>
    <div class="Hui-article">

        @if(session('status'))
            <script>
                setTimeout(() => {
                    layer.msg("{{session('status')}}");
                }, 100)
            </script>
        @endif

        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
                    <a class="btn btn-primary radius" href="/admin/roleadd">
                        <i class="Hui-iconfont">&#xe600;</i> 新增角色</a></span>
                </span>
                <span class="r">共有数据：<strong>{{ $roles->total() }}</strong> 条</span>
            </div>
            <div class="mt-20">
                <table class="table table-border table-bordered table-bg table-hover table-sort">
                    <thead>
                    <tr class="text-c">
                        <th width="80">角色描述</th>
                        <th width="80">角色名称（英文）</th>
                        <th width="80">守护器</th>
                        <th width="30">注册时间</th>
                        <th width="30">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($roles as $role)
                        <tr class="text-c">
                            <td>
                                {{$role['describe']}}
                            </td>

                            <td>
                                {{$role['name']}}
                            </td>

                            <td>
                                {{$role['guard_name']}}
                            </td>

                            <td class="f-14 td-manage">
                                {{$role['created_at']}}
                            </td>

                            <td>
                                <a href="/admin/roleedit/{{$role['id']}}" class="btn btn-xs btn-warning">编辑角色权限</a>
                                <form action="/admin/roledel/{{$role['id']}}" method="post" style="display: inline">
                                    @csrf
                                    <button onclick="return confirm('ok？')" type="submit" class="btn btn-xs btn-danger">
                                        删除角色
                                    </button>
                                </form>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
            <style>
                .page {
                    text-align: center;
                    padding: 10px;
                }

                .page ul li {
                    float: left;
                    padding: 5px 10px;
                    color: dodgerblue;
                    border: 1px dodgerblue solid;
                    border-radius: 5px;
                    margin-left: 5px;
                }

                .page ul li a {
                    padding: 5px;
                }
            </style>
            <div class="page">
                {{ $roles->links() }}
            </div>
        </article>
    </div>
@endsection
